#ifndef RSIM_ROTATION_H
#define RSIM_ROTATION_H

/* -------------------------------------------------------------------------- *
 * File: Rotation.h                                                           *
 * Authors: Kishor Bhalerao                                                   *
 * Email : kishor8dm@gmail.com                                                *
 * Contributors:                                                              *
 * Email:                                                                     *
 * copyright (c) 2010 Authors.                                                *
 *                                                                            *
 * This program is free software: you can redistribute it and/or modify it    *
 * under the terms of the GNU General Public License as published by the Free *
 * Software Foundation, either version 3 of the License, or any later version.*
 *                                                                            *
 * This program is distributed in the hope that it will be useful, but        *
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   *
 * for more details. (http://www.gnu.org/licenses/)                           *
 * -------------------------------------------------------------------------- */

#include "Mat3x3.h"
#include "LinAlgDecl.h"

#include <string.h>

namespace RSIM{

/** 	Consider two frames A and B which are originally coincident. The angles given
        are those corresponding to the body fixed or space fixed transformation from
        frame A to the new frame B. The rotation Matrix is R_AB. That is if a vector 
        in frame B is v_B and the same vector in frame A is v_A then v_A = R_AB * v_B.
*/	

class Rotation: public Mat3x3_<double>{
        public:
                /** Default rotation matrix is identity. */
                Rotation();
                
                /** Deep copy */
                Rotation(const Rotation& Rot);
                
                /** Deep copy */
                void operator=(const Rotation& Rot);
                
                /** Deep copy */
                void operator=(const Mat3x3&);
                
                /** set rotation matrix from quaternion */
                Rotation(const Quaternion&);
                
                /** Deep copy*/
                Rotation(const Mat3x3&);
                
                /** Can be used to create body123 or space123
                Legal arguments for const char *ch are "Body123" and "Space123" */
                Rotation(const double& ang1, const double& ang2, const double& ang3, const char *ch);
                
                /** Body fixed 123 Euler angles */
                void setRotationBody123(const Vect3& q);
                
                /** Matrix for rotation about z axis */
                void setRotationZAxis(const double& angle);
                
                /** Space fixed 123 Euler angles */
                void setRotationSpace123(const Vect3& q);
                
                /** Set Rotation Matrix from Quaternion */
                void setRotationFromQuaternion(const Quaternion& e);
                
                /** Set Rotation Matrix from Quaternion 
                q[0] = e0, q[1] = e1, q[2] = e2, q[3] = e3 */
                void setRotationFromQuaternion(const double *q);
};

} // namespace RSIM

#endif